﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Edu.Web.Biz;
using Edu.Web.Data.Service;

namespace Edu.Web.Controllers
{
    /// <summary>
    /// 学生控制器
    /// </summary>
    public class StudentController : BaseController
    {
        private readonly IStudentService _studentService;
        private readonly ITimeTableService _timeTableService;
        public StudentController(IStudentService studentService, ITimeTableService timeTableService)
        {
            _studentService = studentService;
            _timeTableService = timeTableService;
        }

        // GET: Student
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 查看学生详情
        /// </summary>
        /// <param name="id">学生的用户ID</param>
        /// <returns></returns>
        public ActionResult Info(long id)
        {
            var studentInfo = _studentService.LoadStudentInfo(id);
            return View(studentInfo);
        }

        public ActionResult List4cource(long id)
        {
            ViewBag.CourceId = id;
            return View();
        }

        [HttpGet]
        public ActionResult GetStudentList(long courceId)
        {
            return Json(_timeTableService.GetCourceStudentList(courceId), JsonRequestBehavior.AllowGet);
        }
    }
}